<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2015/11/19
 * Time: 16:58
 *  废弃原有的 kuaidihelp_report 项目
 */
namespace soa\express\express;
use soa\client;

class report extends client
{
    protected $service_name = "kuaidihelp_express";
    protected $service_url ="http://express.core.kuaidihelp.com/";


    /**
     * 流转信息分析
     * @param $brand
     * @param array $detail
     * @return array
     */
    public function report($brand, array $detail)
    {
        if(!$brand || empty($detail)) {
            return [];
        }
        if(!is_array($detail)) {
            raise(1009, '流转信息必须是数组格式');
        }
        $detail = json_encode($detail);

        return $this->get('v1/express/report', ['brand'=> $brand, 'detail'=> $detail]);
    }

    /**
     * 解析申通单号
     * 返回单号类型，问题原因，涉及到的网点等。
     * @param $waybillNo,数组，或者一个单号，或者多个以“，”分割的单号
     * @return array|mixed
     */
    public function stoAnalysis($waybillNo){
        if(empty($waybillNo))
            return [];

        $result = $this->get('v1/sto_express/expressAnalysis',["waybill_no" => $waybillNo]);

        return $result;
    }
}